﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using mobil_lab1.localhost;

namespace mobil_lab1
{
    public partial class MobApplication : Form
    {
        public MobApplication()
        {
            InitializeComponent();
        }
             

        private void MobApplication_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == System.Windows.Forms.Keys.Up))
            {
                // Up
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Down))
            {
                // Down
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Left))
            {
                // Left
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Right))
            {
                // Right
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Enter))
            {
                // Enter
            }

        }

        private void artistTree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            txbDescription.Text = ((Element)e.Node.Tag).Text;
            artistTree.ExpandNode(e.Node);
        }

        private void artistTree_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            
        }


        private void notification1_ResponseSubmitted(object sender, Microsoft.WindowsCE.Forms.ResponseSubmittedEventArgs e)
        {

        }

        private void menuModify_Click(object sender, EventArgs e)
        {
            ElementForm eform = new ElementForm((Element)artistTree.SelectedNode.Parent.Tag,
                (Element)artistTree.SelectedNode.Tag);
            eform.Show();
        }

        private void menuExit_Click(object sender, EventArgs e)
        {
            Dispose();
        }

        private void menuAdd_Click(object sender, EventArgs e)
        {
            ElementForm eForm = new ElementForm((Element)artistTree.SelectedNode.Tag);
            eForm.Show();
        }

        private void MobApplication_GotFocus(object sender, EventArgs e)
        {
            artistTree.ExpandNode(artistTree.SelectedNode);
        }
    }
}